package gulimall.web;

import gulimall.pojo.vo.OrderConfirmVO;
import gulimall.service.IOrderService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import javax.annotation.Resource;
import java.util.concurrent.ExecutionException;

/**
 * @author HLF
 * @date 2022/8/22 21:37
 */
@Controller
public class OrderWebController {

    @Resource
    private IOrderService orderService;

    /**
     * 跳转到订单结算(订单确认)(confirm.html)页面
     */
    @GetMapping("/toTrade")
    public String toTrade(Model model) throws ExecutionException, InterruptedException {
        OrderConfirmVO confirmVo = orderService.confirmOrder();
        System.out.println("OrderWebController线程id："+Thread.currentThread().getId());
        model.addAttribute("orderConfirmData", confirmVo);
        //展示订单确认的数据
        return "confirm";
    }

}
